package org.lanqiao.sjx.dao.impl;

import java.sql.SQLException;
import java.util.List;

import javax.sound.midi.MidiDevice.Info;

import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.lanqiao.bean.Resume;
import org.lanqiao.bean.Work;
import org.lanqiao.sjx.dao.ResumeDao;
import org.lanqiao.tools.BaseDao;

public class ResumeImpl extends BaseDao implements ResumeDao{

	@Override
	public Integer insertResume(Resume info) {
		String sql="insert into resume (stateId,userId,date) values(1,?,Now())";
		try {
			return query.update(sql,info.getUserId());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public Integer deleteResume(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Resume> selectResume() {
		// TODO Auto-generated method stub
		return null;
	}



	@Override
	public Integer getCountResume(Integer userId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Resume> selectIdbyuserId(Integer userId) {
		String sql="select id from resume where userId=?";
		
		try {
			return query.query(sql,new BeanListHandler<Resume>(Resume.class),userId);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	return null;

 }
	@Override
//	更新简历的名称
	public Integer updateResumeName(String ResumeName,Integer id) {
		String sql="update resume set ResumeName=?,changeTime=Now() where id=?";
		try {
			return query.update(sql,ResumeName,id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
//	更新简历的期望工作
	@Override
	public Integer updateResumeeceptjob(Resume info) {
		String sql="update resume set jobPlace=?,jobType=?,jobPosition=?,monthlyPay=?,changeTime=Now()  where id=?";
		try {
			return query.update(sql,info.getJobPlace(),info.getJobType(),info.getJobPosition(),info.getMonthlyPay(),info.getId());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
//	更新简历的工作表id
	public Integer updateResumeworkid(Resume info) {
		String sql="update resume set jobIds=?,changeTime=Now()  where id=?";
		try {
			return query.update(sql,info.getJobIds(),info.getId());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
//	更新简历的项目经验表id
	public Integer updateResumeitemid(String itemIds,Integer id) {
		String sql="update resume set itemIds=?,changeTime=Now()  where id=?";
		try {
			return query.update(sql,itemIds,id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
//更新简历的教育经验表id
	public Integer updateResumeeduid(String educationIds,Integer id) {
		String sql="update resume set educationIds=?,changeTime=Now()  where id=?";
		try {
			return query.update(sql,educationIds,id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public Integer updateResumeselfdes(String selfDescription,Integer id) {
		String sql="update resume set selfDescription=?,changeTime=Now()  where id=?";
		try {
		
			return query.update(sql,selfDescription,id);
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public Integer updateResumezuopinid(String zuopinIds,Integer id) {
		String sql="update resume set zuopinIds=?,changeTime=Now()  where id=?";
		try {
			return query.update(sql,zuopinIds,id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public List<Resume> selectInfo(Integer id) {
		String sql="select * from resume where id=?";
		
		try {
			return query.query(sql,new BeanListHandler<Resume>(Resume.class),id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	return null;
	}		
}
